package d1211.r211.num16;

import java.util.Scanner;

public class Student {
    static Scanner sc=new Scanner(System.in);
    String Name;
    String  Password;
    public Student() {
    }

    public Student(String name, String password) {
        Name = name;
        Password = password;
    }

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public String getPassword() {
        return Password;
    }

    public void setPassword(String password) {
        Password = password;
    }

    public static void main(String[] args) {


     	//创建普通对象
            Student student = new Student("张三", "1234");
            //实现序列化：序列化就是将内存中的Java对象已制定的二进制序列写入到特定的流中

            //实现反序列化
            Student student2 =  new Student() ;
            System.out.println(student2);
            String name2 = student2.getName();
            String password2 = student2.getPassword();
            System.out.println(name2);

            System.out.println("请输入用户名:");
            String name = sc.next();
            System.out.println("请输入用户密码：");
            String password = sc.next();
            if(name.equals(student2.getName()) && password.equals(student2.getPassword())) {
                System.out.println("登陆成功");
            }else {
                System.out.println("登陆失败！");
            }


        }


    }

